package com.ithe.canteen.common;

import lombok.*;

@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class Result {
    public static final String SUCCESS = "200";
    public static final String ERROR = "500";

    private String code;
    private String msg;
    private Object data;

    public static Result success() {
        return new Result(SUCCESS, "请求成功", null);
    }

    public static Result success(Object data) {
        return new Result(SUCCESS, "请求成功", data);
    }

    public static Result error(String code, String msg) {
        return new Result(code, msg, null);
    }

    public static Result error(String msg) {
        return new Result(ERROR, msg, null);
    }

}
